package com.pinghua.regena.auth.handler;

import com.coffee.core.JSONUtils;
import com.coffee.oauth.CoffeeRegisteredClientDetails;
import com.coffee.oauth.handler.CoffeeRegisteredClientDetailsLoadHandler;
import org.springframework.stereotype.Component;

/**
 * @author songkui
 * @since 2025-4-17
 */
@Component
public class RegisteredClientDetailsLoadHandler implements CoffeeRegisteredClientDetailsLoadHandler {

    //TODO 获取客户端信息
    public CoffeeRegisteredClientDetails handle(String clientId){
        String json = "{\"authorizedGrantTypes\":[\"password\",\"refresh_token\",\"authorization_code\",\"client_credentials\",\"mobile\"],\"additionalInformation\":\"{\\\"enc_flag\\\":\\\"1\\\",\\\"captcha_flag\\\":\\\"1\\\",\\\"online_quantity\\\":\\\"1\\\"}\",\"clientId\":\"pig\",\"autoapprove\":\"false\",\"updateTime\":\"2023-03-08T11:32:41\",\"delFlag\":\"0\",\"accessTokenValidity\":43200,\"createBy\":\"\",\"updateBy\":\"admin\",\"refreshTokenValidity\":2592001,\"scope\":\"server\",\"clientSecret\":\"pig\",\"webServerRedirectUri\":\"http://localhost:4040/sso1/login,http://localhost:4041/sso1/login,http://localhost:8080/renren-admin/sys/oauth2-sso,http://localhost:8090/sys/oauth2-sso\",\"id\":5}";
        CoffeeRegisteredClientDetails coffeeRegisteredClientDetails = JSONUtils.parse(json, CoffeeRegisteredClientDetails.class);
        return coffeeRegisteredClientDetails;
    }
}
